<template>
  <div>
    <!-- <div>
      原始用法
      <el-tag
        :key="tag"
        v-for="tag in dynamicTags"
        closable
        :disable-transitions="false"
        @close="handleClose(tag)"
      >
        {{tag}}
      </el-tag>
      <el-input
        class="input-new-tag"
        v-if="inputVisible"
        v-model="inputValue"
        ref="saveTagInput"
        size="small"
        @keyup.enter.native="handleInputConfirm"
        @blur="handleInputConfirm"
      >
      </el-input>
      <el-button
        v-else
        class="button-new-tag"
        size="small"
        @click="showInput"
      >+ New Tag</el-button>
    </div> -->
    <div>
      可编辑tag
      <star-input-tag
        :tagList="dynamicTags"
        @input="editTag"
      ></star-input-tag>
    </div>
  </div>
</template>
<script>
import starInputTag from '@/views/MyTag/starInputTag'
export default {
  components: {
    starInputTag
  },
  data() {
    return {
      dynamicTags: [{ Id: 1, Name: '标签一' }, { Id: 2, Name: '标签二' }, { Id: 2, Name: '标签三' }]
      // inputVisible: false,
      // inputValue: ''
    }
  },
  methods: {
    editTag(tagList) {
      console.log(tagList)
    }
    // ,
    // handleClose(tag) {
    //   this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1)
    // },

    // showInput() {
    //   this.inputVisible = true
    //   this.$nextTick(_ => {
    //     this.$refs.saveTagInput.$refs.input.focus()
    //   })
    // },

    // handleInputConfirm() {
    //   let inputValue = this.inputValue
    //   if (inputValue) {
    //     this.dynamicTags.push(inputValue)
    //   }
    //   this.inputVisible = false
    //   this.inputValue = ''
    // }
  }
}
</script>

<style>
.el-tag + .el-tag {
  margin-left: 10px;
}
.button-new-tag {
  margin-left: 10px;
  height: 32px;
  line-height: 30px;
  padding-top: 0;
  padding-bottom: 0;
}
.input-new-tag {
  width: 90px;
  margin-left: 10px;
  vertical-align: bottom;
}
</style>
